﻿Imports System.Data.SqlClient

Public Class clsBITACORA_SISTEMA
    Private cnConn As New SqlConnection
    Private Command As SqlCommand

    Public Sub CONECTA_BITACORA()
        Dim sql As String = "Insert Into BITACORA " & _
                          "VALUES (" & _
                          "@DESCRIPCION," & _
                          "@FECHA," & _
                          "@USUARIO," & _
                          "@MODULO," & _
                          "@ACCION)"

        cnConn.ConnectionString = CitraConnection
        Command = New SqlCommand(sql, cnConn)

        Try
            cnConn.Open()
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Information, "Aviso")
            If cnConn.State = ConnectionState.Open Then
                cnConn.Close()
            End If
        End Try
    End Sub
    Public Sub REGISTRA(ByVal ACTIVIDAD As String, ByVal MODULO As String, ByVal ACCION As String)
        Command.Parameters.AddWithValue("DESCRIPCION", ACTIVIDAD)
        Command.Parameters.AddWithValue("FECHA", Now())
        Command.Parameters.AddWithValue("USUARIO", UsuarioActivo)
        Command.Parameters.AddWithValue("MODULO", MODULO)
        Command.Parameters.AddWithValue("ACCION", ACCION)

        Dim RowsAffected As Integer

        Try
            RowsAffected = Command.ExecuteNonQuery
        Catch ex As Exception

        End Try



    End Sub
    Public Sub DESCONECTA_BITACORA()
        If cnConn.State = ConnectionState.Open Then
            cnConn.Close()
        End If
    End Sub
End Class
